<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>菜单管理</title>

<script src="scripts/jquery.min.js"></script>
<script src="scripts/bootstrap.min.js"></script>

<link rel="stylesheet" href="jquery-treetable/stylesheets/jquery.treetable.css">
<link rel="stylesheet" href="jquery-treetable/stylesheets/jquery.treetable.theme.default.css">
<script type="text/javascript" src="jquery-treetable/javascripts/src/jquery.treetable.js"></script>
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/hds.css">


</head>
<body>
	<div class="panel panel-default">
		<div class="panel-body">
			<shiro:hasPermission name="system:menu:create">
				<input type="button" class="btn btn-info" href="resourceAction!showCreateForm.action?pid=0" id="addParent" value="&nbsp;新增资源" data-toggle="modal" data-target="#myModal" style="font-size: 16px" />
			</shiro:hasPermission>
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content"></div>
				</div>
			</div>
		</div>
		<table class="table table-hover table-condensed" id="table">
			<thead class="row">
				<tr>
					<th class="col-md-2 col-sm-2">名称</th>
					<th class="col-md-2 col-sm-2">类型</th>
					<th class="col--md-3 col-sm-3">URL路径</th>
					<th class="col--md-2 col-sm-2">权限字符串</th>
					<th class="col--md-3 col-sm-3">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${resourceList}" var="resource">
					<tr data-tt-id="${resource.id}" <c:if test="${resource.parentId !=0 }">data-tt-parent-id="${resource.parentId}"</c:if>>
						<td>${resource.name }</td>
						<td>${resource.type }</td>
						<td>${resource.url }</td>
						<td>${resource.permission }</td>
						<td><c:if test="${resource.type ne 'button'}">
								<shiro:hasPermission name="system:menu:create">
										<a href="resourceAction!showCreateForm.action?pid=${resource.id}" data-toggle="modal" data-target="#myModal" style="font-size: 20px;"><span class="glpyhicon glyphicon-plus" style="padding-left:0em;"></span></a>
								</shiro:hasPermission>
							</c:if> 
							<shiro:hasPermission name="system:menu:create">
							<a href="resourceAction!showUpdateForm.action?id=${resource.id}" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-pencil"></a> 
								</shiro:hasPermission>
							<shiro:hasPermission name="system:menu:create">
								<a class="deleteBtn" href="resourceAction!showDeleteForm.action?id=${resource.id}" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-trash"></span></a>
							</shiro:hasPermission>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<script>
		$(function() {
			$("#table").treetable({
				expandable : true
			});
		});
	</script>
</body>
</html>